﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace ExcellentCRM.DataService.Models
{
    [ComplexType]
    public class StudentInfo
    {
        /// <summary>
        /// 学号
        /// </summary>
        [StringLength(20)]
        [Display(Name = "学号")]
        public string StuNumber { get; set; }

        [Required(AllowEmptyStrings = false)]
        [StringLength(30)]
        [Display(Name = "姓名")]
        public string StuName { get; set; }

        [Display(Name = "年龄")]
        public int? Age { get; set; }

        [Display(Name = "性别")]
        public GenderType Gender { get; set; }

        /// <summary>
        /// 电话
        /// </summary>
        [StringLength(20)]
        [Display(Name = "电话")]
        public string Phone { get; set; }

        /// <summary>
        /// 手机
        /// </summary>
        [StringLength(20)]
        [Display(Name = "手机")]
        public string CellPhone { get; set; }

        [EmailAddress]
        [DataType(DataType.EmailAddress)]
        [StringLength(100)]
        [Display(Name = "邮箱")]
        public string Email { get; set; }

        [Display(Name = "生日")]
        [DataType(DataType.Date)]
        public DateTime? DateOfBirth { get; set; }

        [Display(Name = "公司名称")]
        [StringLength(100)]
        public string CompanyName { get; set; }

        /// <summary>
        /// 部门职务
        /// </summary>
        [StringLength(30)]
        [Display(Name = "职务")]
        public string Position { get; set; }

        [StringLength(300)]
        [Display(Name = "公司地址")]
        public string CompanyAddress { get; set; }

        [StringLength(300)]
        [Display(Name = "地址")]
        public string HomeAddress { get; set; }

        /// <summary>
        /// 行业
        /// </summary>
        [StringLength(50)]
        [Display(Name = "行业")]
        public string Profession { get; set; }

        [RegularExpression(@"^\d{5,15}$", ErrorMessage = "QQ号码为5-15位数字")]
        [StringLength(30)]
        [Display(Name = "QQ号码")]
        public string QQNumber { get; set; }

        [NotMapped]
        public static Dictionary<GenderType, string> GenderTypeDic =
            new Dictionary<GenderType, string>
                {
                    {GenderType.Male, "男"},
                    {GenderType.Female, "女"}
                };
    }

    public enum GenderType
    {
        Female = 0,
        Male = 1
    }
}